GtkThemingEngine: Render frames and spinbutton boxes properly.
authorCarlos Garnacho <carlosg@gnome.org>
Mon, 2 Aug 2010 13:48:31 +0000 (15:48 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Sat, 4 Dec 2010 14:37:24 +0000 (15:37 +0100)
gtk/gtkthemingengine.c

index 972722e5ae7671fb283f54d32aedf462e9266d57..51d561d1b697006d48352a278725a6af3089eaea 100644 (file)
@@ -940,7 +940,8 @@ gtk_theming_engine_render_frame (GtkThemingEngine *engine,
   color_shade (bg_color, 1.3, &lighter);
 
   if (gtk_theming_engine_has_class (engine, "entry") ||
-      gtk_theming_engine_has_class (engine, "scrolled-window"))
+      gtk_theming_engine_has_class (engine, "scrolled-window") ||
+      gtk_theming_engine_has_class (engine, "viewport"))
     {
       gdk_cairo_set_source_color (cr, bg_color);
       add_path_rectangle_sides (cr, x + 1, y + 1, width - 2, height - 2,
@@ -984,23 +985,36 @@ gtk_theming_engine_render_frame (GtkThemingEngine *engine,
     }
   else if (gtk_theming_engine_has_class (engine, "spinbutton"))
     {
-      gdk_cairo_set_source_color (cr, &lighter);
-      add_path_rectangle_sides (cr, x, y, width, height,
-                                SIDE_BOTTOM | SIDE_RIGHT);
-      cairo_stroke (cr);
+      if (gtk_theming_engine_has_class (engine, "button"))
+        {
+          gdk_cairo_set_source_color (cr, &lighter);
+          add_path_rectangle_sides (cr, x + 1, y + 2, width - 3, height - 2, SIDE_TOP);
+          cairo_stroke (cr);
 
-      gdk_cairo_set_source_color (cr, &darker);
-      add_path_rectangle_sides (cr, x, y, width, height, SIDE_TOP);
-      cairo_stroke (cr);
+          gdk_cairo_set_source_color (cr, &darker);
+          add_path_rectangle_sides (cr, x + 1, y + 2, width - 3, height - 2, SIDE_BOTTOM);
+          cairo_stroke (cr);
+        }
+      else
+        {
+          gdk_cairo_set_source_color (cr, &lighter);
+          add_path_rectangle_sides (cr, x, y, width, height,
+                                    SIDE_BOTTOM | SIDE_RIGHT);
+          cairo_stroke (cr);
 
-      gdk_cairo_set_source_color (cr, bg_color);
-      add_path_rectangle_sides (cr, x, y, width - 1, height - 1, SIDE_BOTTOM);
-      cairo_stroke (cr);
+          gdk_cairo_set_source_color (cr, &darker);
+          add_path_rectangle_sides (cr, x, y, width, height, SIDE_TOP);
+          cairo_stroke (cr);
 
-      cairo_set_source_rgb (cr, 0, 0, 0);
-      add_path_rectangle_sides (cr, x + 1, y + 1, width - 2, height - 2,
-                                SIDE_TOP | SIDE_LEFT | SIDE_RIGHT);
-      cairo_stroke (cr);
+          gdk_cairo_set_source_color (cr, bg_color);
+          add_path_rectangle_sides (cr, x, y, width - 1, height - 1, SIDE_BOTTOM);
+          cairo_stroke (cr);
+
+          cairo_set_source_rgb (cr, 0, 0, 0);
+          add_path_rectangle_sides (cr, x, y + 1, width - 1, height - 3,
+                                    SIDE_TOP | SIDE_LEFT | SIDE_RIGHT);
+          cairo_stroke (cr);
+        }
     }
   else
     {